package ui
{
	import feathers.controls.ScrollContainer;
	import feathers.core.FeathersControl;
	import feathers.layout.HorizontalLayout;
	
	import starling.text.TextField;
	
	public class TopGameMenu extends FeathersControl
	{
		private var counterTXT:TextField;
		private var countSteps:uint = 0;
		private var container:ScrollContainer;
		public function TopGameMenu()
		{
			super();
		}
		
		override protected function draw():void
		{
			// TODO Auto Generated method stub
			super.draw();
			setSizeInternal(200,30,true);
			container.validate();
			container.x = (stage.stageWidth - container.width)/2>>1;
			container.y = 10;
		}
		
		override protected function initialize():void
		{
			// TODO Auto Generated method stub
			super.initialize();
			
			counterTXT = new TextField(300,60,"Count steps: 000","Verdana",24,0xFA00AA,true);
			counterTXT.autoScale = true;
			
			var hLayer:HorizontalLayout = new HorizontalLayout();
			hLayer.paddingLeft = hLayer.paddingRight = 0;
			hLayer.paddingTop = hLayer.paddingBottom = 0;
			hLayer.gap = 2;
			
			container = new ScrollContainer();
			container.layout = hLayer;
			container.addChild(counterTXT);
			addChild(container);
			
		}
		
		private function getCounterSteps(count:uint):String{
			if(count<10){
				return "00"+count;
			}
			if(count<100){
				return "0"+count;
			}
			if(count<1000){
				return count.toString();
			}
			return "000";
		}
		public function addStepInCounterTxt():void{
			counterTXT.text = "Count steps: "+getCounterSteps(++countSteps);
		}
		
		public function setCounterText(value:String):void{
			counterTXT.text = value;
		}
		
	}
}